提供了边缘终端的增删改查、分页查询、批量创建、批量删除、批量启用、批量禁用、查询功能列表等功能。
功能描述:新建一个边缘终端,返回新建边缘终端的id、apiKey,用于该设备的信息鉴权。
POST /api/v1/devices
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
name | string | 设备名称 | Yes |
description | string | 设备描述 | No |
Body example:
{
"name": "strinerg"
}
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646&productId={productId}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "strinerg"
}'
Response data:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
apiKey | string | 设备key |
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": {
"apiKey": "NGNlYTkxMDk1MDdjYWNkOGUyZjI=",
"id": 41
}
}
功能描述:查询指定边缘终端,返回该设备的详细信息。
GET /api/v1/devices/{deviceId}
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/{deviceId}?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
created | long | 创建时间 |
description | string | 描述 |
adminState | int | 启用状态,0-禁用,1-启用,2-用户禁用 |
apiKey | string | 设备key |
connectGatewayId | string | 当前连接的网关 |
encrypt | boolean | 是否加密,0:不加密,1:加密 |
name | string | 设备名 |
labels | string[] | 产品标签 |
id | int | 设备ID |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 位置 |
modified | long | 修改时间 |
operatingState | string | 在线状态(-1:无在线状态 /0-disabled,1-enabled,2-gatewayenabled,3-未激活) |
parentId | int | 关联网关ID |
userId | string | 用户ID |
protocolType | int | 协议类型,1:MQTT,4:Modbus,5:OPC UA,7:BACnet |
productId | int | 产品ID |
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": {
"id": "116",
"apiKey": "ZTcyOTMxMWVmNWI1YzMwMDM5NDY=",
"productId": "33",
"name": "api_device_mu01",
"description": "api_device_mu01",
"adminState": 0,
"operatingState": 1,
"labels": [],
"lastConnected": 0,
"lastReported": 0,
"userId": "aa0a5029-e4a7-4216-a713-f7451fcc1e33",
"created": 156637312502341,
"modified": 115663731250143,
"protocolType": 1,
"connectGatewayId": "123484657",
"location": "ws3edsw",
"encrypt": false
}
}
功能描述:更新指定边缘终端的基本属性。
PUT /api/v1/devices/{deviceId}
Body:
Name | Type | Description | Required |
---|---|---|---|
name | string | 设备名称 | No |
description | string | 设备描述信息 | No |
Body example:
{
"name": "stri324g"
}
cURL example:
curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/{deviceId}?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "stri324g"
}'
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": null
}
功能描述:删除指定边缘终端。
DELETE /api/v1/devices/{deviceId}
cURL example:
curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/{deviceId}?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": null
}
功能描述:分页查询边缘终端列表,返回具体分页信息和边缘终端列表。
GET /api/v1/devices/multi
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | No |
pageSize | int | 分页大小 | Yes |
currentPage | int | 页码 | Yes |
name | string | 设备名称(模糊匹配) | No |
deviceId | int | 设备ID | No |
adminState | int | 启用状态(0:所有/ 1:禁用/ 2:启用) | No |
operatingState | int | 在线状态(0:所有 / 1:离线 / 2:在线 / 3:未激活),当参数adminState=1时,该查询条件无意义 | No |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646&productId={productId}¤tPage={currentPage}&pageSize={pageSize}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 页码 |
pageSize | int | 每页条数(范围:1-50) |
content | struct[] | 当前页内容 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
name | string | 设备名 |
userId | string | 用户ID |
productId | int | 产品ID |
productName | string | 产品名 |
created | long | 创建时间 |
modified | long | 修改时间 |
description | string | 设备描述信息 |
adminState | int | 启用状态(0:禁用 / 1:启用 / 2:用户被禁用) |
operatingState | int | 在线状态(-1:无在线状态 / 0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
labels | string[] | 产品标签 |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 暂留 |
apiKey | string | 设备KEY |
protocolType | int | 协议(1:MQTT / 4:Modbus / 5:OPC UA / 7:BACnet) |
connectGatewayId | String | 当前连接的网关 |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
parentid | int | 网关ID |
addressable | string | 寻址信息 |
Response example:
{
"data": {
"currentPage": 1,
"pageSize": 5,
"totalCount": 1,
"totalPage": 1,
"content": [
{
"id": 10014757,
"name": "test",
"userId": null,
"productId": 102557,
"created": 1592185426676,
"modified": 1592185426902,
"description": "这是一个test设备",
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 0,
"lastReported": 0,
"location": null,
"apiKey": "NDQ5ODAwOWIyZmFhZjg4OWY0YjM=",
"protocolType": 1,
"connectGatewayId": "0",
"encrypt": false,
"productName": "",
"subscription": null,
"authKey": null,
"psk": "",
"pskString": null,
"imei": "",
"imsi": "",
"addressable": null,
"parentid": null
}
]
},
"success": true,
"code": 0,
"msg": null
}
功能描述:提供批量创建边缘终端的能力,返回设备信息列表,每项信息包含id和apiKey, 用于对应新建设备的信息鉴权。
注:设备创建数量上限为2000。
POST /api/v1/devices/multi
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
list | struct[] | 设备列表 | Yes |
list的子对象结构体:
Name | Type | Description | Required |
---|---|---|---|
name | string | 设备名称 | Yes |
description | string | 设备描述 | No |
Body example:
{"list":[
{
"name":"api_device_M02",
"description":"test device"
},
{
"name":"api_device_M03",
"description":"test device"
}
]}
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/multi?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646&productId={productId}' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"list":[
{
"name":"api_device_M02",
"description":"test device"
},
{
"name":"api_device_M03",
"description":"test device"
}
]
}'
Response data:
Name | Type | Description |
---|---|---|
data | struct[] | 批量创建边缘终端返回结构体 |
data的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
apiKey | string | 设备key |
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": [
{"id":114,
"apiKey":"NWVkM2Q2YjgwNzllMmU3ZTdiYWM="},
{"id":115,
"apiKey":"NmViYWFmYzY2Y2MwODc5YzcxYjU="
}]
}
功能描述:提供批量删除边缘终端的能力,返回删除边缘终端的数量。
DELETE /api/v1/devices
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | int[] | 设备ID数组 | Yes |
Body example:
{
"deviceIds": [114, 115]
}
cURL example:
curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [114, 115]
}'
Response data:
Name | Type | Description |
---|---|---|
data | int | 批量删除边缘终端的数量 |
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": 2
}
功能描述:提供批量启用指定产品下设备的能力。
PUT /api/v1/devices/unlock
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | int[] | 设备ID数组 | Yes |
Body example:
{
"deviceIds": [118, 119]
}
cURL example:
curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/unlock?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [118, 119]
}'
Response data:
Name | Type | Description |
---|---|---|
data | int | 批量启用边缘终端的数量 |
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": 2
}
功能描述:提供批量启用指定产品下设备的能力。
PUT /api/v1/devices/lock
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | int[] | 设备ID数组 | Yes |
Body example:
{
"deviceIds": [118, 119]
}
cURL example:
curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lock?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [118, 119]
}'
Response data:
Name | Type | Description |
---|---|---|
data | int | 批量禁用边缘终端的数量 |
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": 2
}
功能描述:根据产品ID、设备ID,查询设备的功能列表。
GET /api/v1/devices/{id}/properties
Path:
Name | Type | Description | Required |
---|---|---|---|
id | string | 设备ID | Yes |
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/{id}/properties?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646&productId={productId}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
name | string | 功能名称 |
identifier | string | 属性名称(该产品下唯一) |
accessMode | int | 属性读写类型,只读(1:R),读写(2:RW),只写(3:W) |
type | int | 数据类型 |
unit | string | 属性单位 |
minimum | number | 参数最小值(数值类型特有) |
maximum | number | 参数最大值(数值类型特有) |
nodeName | string | 节点名称 |
special | struct | 对部分数据类型的补充说明 |
id | int | 功能ID |
userId | string | 用户ID |
productId | int | 产品ID |
required | int | 是否必须 |
kind | int | 功能分类(1:标准/2:自定义) |
class | int | 功能种类 (1:属性/2:事件) |
special的子对象结构体:
Name | Type | Description |
---|---|---|
length | int | string类型的字符串长度,1~2048 |
step | double | 步长, 设备上传数据间隔, 整型/浮点型类型才有, 分别对应整型、浮点 |
enumArray | struct[] | 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) |
enumArray的子对象结构体:
Name | Type | Description |
---|---|---|
key | int | 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) |
describe | string | 值对应的说明 |
Response example:
[
{
"id": 9426,
"userId": null,
"productId": 103609,
"name": "test",
"nodeName": "",
"identifier": "test",
"accessMode": 2,
"type": 5,
"unit": "",
"minimum": 1,
"maximum": 10,
"minString": null,
"maxString": null,
"special": {
"length": null,
"step": 5.0,
"enumArray": null
},
"required": false,
"kind": 2,
"class": 1
}
]
功能描述:分页获取批次列表。
GET /api/v1/products/batch/page
Query:
Name | Type | Description | Required |
---|---|---|---|
currentPage | int | 页码 | Yes |
pageSize | int | 分页大小 | Yes |
pid | int | 产品ID | No |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/products/batch/page?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&pageSize=10¤tPage=1&pid=1200000' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
count | int | 设备数量 |
id | int | 批次ID |
created | long | 创建时间 |
protocolType | int | 产品协议 |
Response example:
{
"code": 0,
"message": "成功",
"referInfo": null,
"data": {
"currentPage": 1,
"pageSize": 10,
"totalCount": 1,
"totalPage": 1,
"content": [
{
"id": 100184,
"count": 2,
"created": 1593420792282,
"protocolType": 1
}
]
}
}
功能描述:分页获取批次下的设备列表。
GET /api/v1/devices/batch/page
Query:
Name | Type | Description | Required |
---|---|---|---|
batchId | int | 批次id | Yes |
currentPage | int | 页码 | Yes |
pageSize | int | 分页大小 | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/batch/page?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&batchId=10000502&pageSize=10¤tPage=1' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
name | string | 设备名 |
adminState | int | 启用状态:0-禁用,1-启用,2-用户禁用 |
description | string | 设备描述 |
s_version | string | OTA升级用,软件版本 |
f_version | string | OTA升级用,模组固件版本 |
id | int | 设备ID |
productId | int | 产品ID |
operatingState | int | 上下线状态(0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
apiKey | string | 设备key |
connectGatewayId | int | 当前连接的网关 |
lastReported | long | 最近上报状态的时间 |
modified | long | 更新时间 |
created | long | 创建时间 |
lastConnected | long | 最近上线时间 |
protocolType | int | 协议(1:MQTT / 4:Modbus / 5:OPC UA / 7:BACnet) |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
deviceId | int | 设备id |
certSN | string | 证书序列号 |
certificate | string | 证书 |
privateKey | string | 证书密钥 |
productName | string | 产品名称 |
Response example:
{
"data": {
"currentPage": 1,
"pageSize": 5,
"totalCount": 1,
"totalPage": 1,
"content": [
{
"productId": 103609,
"apiKey": "Y2E2ODFhNTA5NzQ5MzIyNDI2ZTg=",
"operatingState": 3,
"created": 1593832798945,
"certificate": "",
"description": "",
"protocolType": 1,
"certSN": "",
"deviceId": 0,
"s_version": "",
"productName": "边缘终端1",
"privateKey": "",
"connectGatewayId": 0,
"lastConnected": 0,
"lastReported": 0,
"encrypt": false,
"f_version": "",
"name": "device123_1",
"adminState": 1,
"modified": 1593832798945,
"id": 10030415
}
]
},
"success": true,
"code": 0,
"msg": null
}
功能描述:分页查询当前边缘管理平台全部边缘终端列表,返回具体分页信息和边缘终端列表,仅限顶层用户使用。
GET /api/v1/devices/multi/all
Query:
Name | Type | Description | Required |
---|---|---|---|
pageSize | int | 分页大小,一次性允许最多查询1000个设备列表信息 | Yes |
currentPage | int | 页码 | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/multi/all?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&pageSize=100¤tPage=1' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
name | string | 设备名 |
userId | string | 用户ID |
productId | int | 产品ID |
productName | string | 产品名 |
created | long | 创建时间 |
modified | long | 修改时间 |
description | string | 设备描述信息 |
adminState | int | 启用状态(0:禁用 / 1:启用 / 2:用户被禁用) |
operatingState | int | 在线状态(-1:无在线状态 /0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
labels | string[] | 产品标签 |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 暂留 |
apiKey | string | 设备KEY |
protocolType | int | 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) |
connectGatewayId | String | 当前连接的网关 |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
parentid | int | 网关ID |
imei | string | 移动设备国际识别码,用于设备鉴权。填写内容需保持与设备内置信息一致。imei在产品下唯一 |
imsi | string | 国际移动用户识别码,用于区别移动用户的有效信息。填写需保持与SIM卡中信息一致 |
addressable | string | 寻址信息 |
psk | string | OneNET平台支持基于PSK(pre-shared key,预计共享秘钥)的DTLS加密,用于认证和数据安全传输。仅支持字母和数字,长度8~32。 |
Response example:
{
"data": {
"currentPage": 1,
"pageSize": 5,
"totalCount": 1,
"totalPage": 1,
"content": [
{
"id": 10013077,
"name": "nbd1",
"userId": null,
"productId": 101643,
"created": 1587720115599,
"modified": 1587720115599,
"description": null,
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 1588041986935,
"lastReported": null,
"location": null,
"apiKey": "OTk1ZGQ1NjZhNzhlZmU3NDU4NDU=",
"protocolType": 2,
"connectGatewayId": null,
"encrypt": null,
"productName": "nb111",
"subscription": null,
"authKey": null,
"psk": null,
"pskString": null,
"imei": "214135234",
"imsi": null,
"addressable": null,
"parentid": null
}
]
},
"success": true,
"code": 0,
"msg": null
}